package controller.weapon
{
	import enums.weapon.WeaponViewSCPageIndex;
	
	import model.vo.weapon.BugStickVo;
	import model.weapon.WeaponModel;
	
	import org.robotlegs.mvcs.StarlingCommand;
	
	import service.SQLService;
	
	import view.event.weapon.bug_stick.BugStickDetailViewEvent;
	import view.event.weapon.bug_stick.BugStickListViewEvent;
	import view.event.weapon.bug_stick.BugStickViewEvent;
	
	
	/**
	 * 请求获得操虫棍详细信息
	 * @author £iang
	 * 
	 */	
	public class GetBugStickDetailCommand extends StarlingCommand
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** sqlService */
		[Inject]
		public var sqlService:SQLService;
		/** weaponModel */
		[Inject]
		public var weaponModel:WeaponModel;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 执行函数 
		 * 
		 */		
		override public function execute():void
		{
			var weaponData:BugStickVo = 
				sqlService.getBugStickDetailInfo( weaponModel.curSearchWeaponId );
			
			var chargeAxeDetailEvent:BugStickDetailViewEvent = 
				new BugStickDetailViewEvent( BugStickDetailViewEvent.SHOW_DETAIL );
			
			chargeAxeDetailEvent.weaponVo = weaponData;
			dispatch( chargeAxeDetailEvent );
			
			var chargeAxeEvent:BugStickViewEvent = 
				new BugStickViewEvent( BugStickViewEvent.CHANGE_PAGE );
			
			chargeAxeEvent.newPage = WeaponViewSCPageIndex.DETAIL_PAGE;
			dispatch( chargeAxeEvent );
			
			dispatch( new BugStickListViewEvent( BugStickListViewEvent.SCROLL_ITEM ) );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function GetBugStickDetailCommand()
		{
			super();
		}
	}
}